<?php
require "common.php";
$id = $_GET['id'];
$result = mysql_query("select * from `article` where `id`='$id'");
$article = mysql_fetch_assoc($result);
if ($_POST){
    $title = $_POST['title'];
    $content = $_POST['content'];
    $category_id = $_POST['category_id'];
    $time = time();
    mysql_query("update `article` set `category_id`='$category_id',`title`='$title',`content`='$content' where `id`='$id'");
    echo "<script>alert('保存成功');location.href='index.php';</script>";
}



require "templates/edit.html";